package org.springrain.selenium.util;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class SeleniumUtils {
	private static WebDriver driver;

	// private static ChromeDriverService service;

	// private static String chromedriverPath="D:/chromedriver.exe";

	public static WebDriver initDriver() throws IOException {

		System.setProperty("webdriver.chrome.driver", "C:/Users/caomei/Downloads/chromedriver.exe");

		// System.setProperty("webdriver.chrome.driver", GlobalStatic.rootDir +
		// "/upload/chromedriver.exe");

		// service = new ChromeDriverService.Builder().usingDriverExecutable(new
		// File(GlobalStatic.rootDir +
		// "/upload/chromedriver.exe")).usingAnyFreePort().build();
		// service.start();
		// driver = new RemoteWebDriver(service.getUrl(), DesiredCapabilities.chrome());
		driver = new ChromeDriver();
		driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
		// 最大化窗口
		driver.manage().window().maximize();
		return driver;

	}

}
